package cn.fl.system.transform;

import java.util.ArrayList;
import java.util.List;

import cmm.user.facade.system.dto.SysUsrFunAuthRDTO;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.system.vo.SysUsrFunAuthRVO;

 /**
 * @Description: 系统用户功能权限关系表 转换器
 * VO是客户端传递数据到服务端进行转换的数据 
 * VO转换数据变成DTO传递到服务端 
 * VO不能在服务端出现
 */
public class SysUsrFunAuthRVOTransform {


	/**
	 * DTO 转  VO
	 * @param po SysUsrFunAuthRDTO
	 * @return SysUsrFunAuthRVO
	 */
	public static SysUsrFunAuthRVO toVO(SysUsrFunAuthRDTO dto) {
		SysUsrFunAuthRVO  vo = null;
		if (dto != null) { 
			vo = new SysUsrFunAuthRVO();
			vo.setId(dto.getId());
			vo.setUsrId(dto.getUsrId());//用户ID
			vo.setRoleId(dto.getRoleId());//角色ID
			vo.setOrgId(dto.getOrgId());//组织架构ID

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto SysUsrFunAuthRVO
	 * @return SysUsrFunAuthRDTO
	 */
	public static SysUsrFunAuthRDTO toDTO(SysUsrFunAuthRVO vo) {
		SysUsrFunAuthRDTO dto = null;
		if (vo != null) {
			dto = new SysUsrFunAuthRDTO();
			dto.setId(vo.getId());
			dto.setUsrId(vo.getUsrId());//用户ID
			dto.setRoleId(vo.getRoleId());//角色ID
			dto.setOrgId(vo.getOrgId());//组织架构ID

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param list List<SysUsrFunAuthR>
	 * @return List<SysUsrFunAuthRDTO>
	 */
	public static List<SysUsrFunAuthRVO> toVOList(List<SysUsrFunAuthRDTO> list) {
		List<SysUsrFunAuthRVO>  voList = new ArrayList<SysUsrFunAuthRVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SysUsrFunAuthRDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	/**
	 * VO集合 转 DTO集合
	 * @param list List<SysUsrFunAuthRVO>
	 * @return List<SysUsrFunAuthRDTO>
	 */
	public static List<SysUsrFunAuthRDTO> toDTOList(List<SysUsrFunAuthRVO> list) {
		List<SysUsrFunAuthRDTO>  dtoList = new ArrayList<SysUsrFunAuthRDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (SysUsrFunAuthRVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
